/**
 * 菜单模块接口文件
 */

import axios from './request';

/**
 * 菜单信息接口
 */
export interface IMenu {
    id: number;
    name: string;
    code: string;
    showParent: boolean;
    type: number;
    sort: number;
    pid: number;
    children?: IMenu[];
}

/**
 * 获取所有菜单
 * @returns 
 */
export const getAll = (): Promise<IMenu[]> => axios.get('/menus/all');

/**
 * 获取我的菜单列表
 * @returns 
 */
export const getMyMenus = (): Promise<IMenu[]> => axios.get('/menus/myMenus');

/**
 * 获取权限
 * @param role_id 
 * @returns 
 */
export const getRights = (role_id: number): Promise<number[]> => axios.get('/menus/rights/' + role_id);